#ifndef QLEARNINGALGORITHM_H
#define QLEARNINGALGORITHM_H
#include <QHash>
#include <QVector>
#include "State.h"

class MapGen;

class QLearningAlgorithm
{
public:
    QLearningAlgorithm(MapGen* mapgen);
    ~QLearningAlgorithm();

public:
    void refreshHashQ();

private:
    void iniQHashWithFloat(QHash<int, QVector<float>>& hash, float f);
    void iniData();
    void setState(State& state, int x, int y, char m_map[ROOM_WIDTH][ROOM_HEIGHT]);

public:
    int maxQDir(int statei);

public:
    QHash<int, QVector<float>> hashR;
    QHash<int, QVector<float>> hashQ;
    QVector<State> vecstates;
private:
    MapGen* m_mapGen;
};


float maxQVec(QVector<float> &vec, int &index);


#endif // QLEARNINGALGORITHM_H
